﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;

namespace LprMiddleWare.Converters
{
    public static class ImageConverter
    {
        public static BitmapImage ToBitmapImage(this byte[] bitmapData)
        {
            var stream = new MemoryStream(bitmapData);
            var image = new BitmapImage();
            image.BeginInit();
            image.StreamSource = stream;
            image.EndInit();
            return image;
        }

        public static System.Drawing.Image ToImage(this byte[] bitmapData)
        {
            var stream = new MemoryStream(bitmapData);
            var img = System.Drawing.Image.FromStream(stream);
            return img;
        }

    }
}
